<template>
  <footer class="footer">
    <!-- 5.0父传子，传入的是新数组的长度 -->
    <span class="todo-count"
      >剩余<strong>{{ leng }}</strong></span
    >
    <ul class="filters">
      <li>
        <!-- 4.6当点击时，出现不同的状态，就会出现不同的页面 -->
        <a
          :class="{ selected: arr === 'all' }"
          href="javascript:;"
          @click="$emit('change', 'all')"
          >全部</a
        >
      </li>
      <li>
        <a
          :class="{ selected: arr === 'no' }"
          href="javascript:;"
          @click="$emit('change', 'no')"
          >未完成</a
        >
      </li>
      <li>
        <a
          :class="{ selected: arr === 'yes' }"
          href="javascript:;"
          @click="$emit('change', 'yes')"
          >已完成</a
        >
      </li>
    </ul>
    <button class="clear-completed" @click="$emit('clear')">清除已完成</button>
  </footer>
</template>

<script>
export default {
  props: {
    arr: String,
    leng: Number,
  },
};
</script>